package com.mf.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mf.entity.Customer;
import com.mf.entity.Warehouse;
import com.mf.service.IWarehouseService;
import com.mf.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mf
 * @since 2024-04-26
 */
@RestController
@RequestMapping("/warehouse")
@Tag(name = "仓库管理")
public class WarehouseController {

    @Resource
    private IWarehouseService warehouseService;

    @Operation(summary = "新增仓库")
    @PostMapping("/add")
    public Result<Boolean> add(@RequestBody Warehouse warehouse) {
        return Result.success(warehouseService.save(warehouse));
    }

    @Operation(summary = "查询有库存的客户")
    @GetMapping("/findIsInventoryByCustom")
    public Result<List<Customer>> findCustomByInventory() {
        return Result.success(warehouseService.findIsInventoryByCustom());
    }
}
